const { defineConfig } = require('@vue/cli-service')
const path = require('path')
module.exports = defineConfig({
  configureWebpack: {
    resolve: {
      fallback: { path: false },
    },
  },
  transpileDependencies: true,
  devServer: {
    host: 'localhost',
    port: 3000,
    open: true,
    proxy: {
      '/api': {
        target: 'https://www.fastmock.site/mock/7dbffa759975376a6a905c4c7658ec9f/mock',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/api'
        }
      }
    }
  },
  lintOnSave: false,
  // eslint-disable-next-line no-irregular-whitespace
  chainWebpack: config => {
    config.resolve.alias
      .set('@', path.join(__dirname, 'src'))
      .set('_views', path.join(__dirname, 'src/views'))
      .set('_components', path.join(__dirname, 'src/components'))
      .set('_api', path.join(__dirname, 'src/api'))
      .set('_utils', path.join(__dirname, 'src/utils'))
  }
})
